/**
 * author: XGP
 * date: 2018/07/19
 * des: 员工花名册form 格式
 */

/**
 * 添加待入职
 */
import { getPositionApi, getRankApi } from './api'
export const addWaitOnjobForm = [
  {
    field: 'userName',
    title: '姓名',
    type: 'text'
  },
  {
    field: 'gender',
    title: '性别',
    type: 'radio',
    optional: [
      {
        name: '男',
        value: '1'
      },
      {
        name: '女',
        value: '0'
      }
    ]
  },
  {
    field: 'mobile',
    title: '手机号码',
    type: 'number'
  },
  {
    field: 'email',
    title: '邮箱',
    type: 'email'
  },
  {
    field: 'expectDate',
    title: '预计入职日期',
    type: 'date'
  },
  {
    field: 'jobType',
    title: '工作性质',
    type: 'text'
  },
  {
    field: 'orgId',
    title: '部门',
    type: 'org'
  },
  {
    field: 'position',
    title: '岗位',
    type: 'text'
  },
  {
    field: 'jobRank',
    title: '职级',
    type: 'text'
  },
  {
    field: 'recruitChannel',
    title: '招聘渠道',
    type: 'text'
  },
  {
    field: 'recommender',
    title: '推荐人',
    type: 'text'
  }
]

/**
 * 展示员工数据list
 */
export const addRosterForm = [
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text'
  },
  {
    field: 'employeeName',
    title: '员工姓名',
    type: 'text',
    customText: (item) => {
      if (item.employeeName) {
        return item.employeeName
      }
      if (item.intvName) {
        return item.intvName
      }
    }
  },
  {
    field: 'sex',
    title: '性别',
    type: 'radio',
    isHiden: true,
    optional: [
      {
        name: '男',
        value: '1'
      },
      {
        name: '女',
        value: '2'
      }
    ]
  },

  {
    field: 'idType',
    title: '证件类型',
    type: 'selected',
    isParams: true,
    paramsId: 'DOCUMENTTYPE',
    isHiden: true
  },
  {
    field: 'idNo',
    title: '证件号码',
    type: 'text',
    isHiden: true
  },
  {
    field: 'orgName',
    title: '部门名称',
    type: 'text',
    disableEdit: true,
    hideDetail: true
  },
  {
    field: 'orgId',
    title: '部门',
    isHiden: true,
    type: 'org'
  },
  {
    field: 'position',
    title: '岗位',
    type: 'selected',
    isParams: true,
    paramsId: 'POST'
  },
  {
    field: 'postLevel',
    title: '职级',
    type: 'selected',
    isParams: true,
    paramsId: 'RANK'

  },
  {
    field: 'employeeStatus',
    title: '员工状态',
    isHiden: true,
    type: 'radio',
    optional: [
      {
        name: '试用',
        value: '0'
      },
      {
        name: '在职',
        value: '9'
      }
    ]
  },
  {
    field: 'constractCompany',
    title: '合同公司',
    isHiden: true,
    type: 'contract-company'
  },
  {
    field: 'workNature',
    title: '工作性质',
    type: 'selected',
    isParams: true,
    paramsId: 'NATUREWORK',
    isHiden: true
  },
  {
    field: 'entryDate',
    title: '入职日期',
    type: 'date'
  },
  {
    field: 'conrrectionDate',
    title: '转正日期',
    type: 'date'
  },
  {
    field: 'mobile',
    title: '手机号码',
    type: 'number'
  },
  {
    field: 'companyEmail',
    title: '公司邮箱',
    type: 'email'
  },
  {
    field: 'workAddree',
    title: '工作地址',
    type: 'selected',
    isParams: true,
    paramsId: 'WORKPLACE'
  },

  {
    field: 'recruitmentChannel',
    title: '招聘渠道',
    type: 'selected',
    isHiden: true,
    isParams: true,
    paramsId: 'RECRUITMENTCHANNEL'
  },
  {
    field: 'statusName',
    title: '状态',
    type: 'text'
  },
  {
    field: 'refereeMan',
    isHiden: true,
    title: '推荐人',
    type: 'text'
  },
  {
    field: 'docList',
    title: '简历附件',
    type: 'file',
    busiKey: 'employeeNo',
    isHiden: true,
    disableEdit: true
  }
]


/**
 * 展示员工数据list
 */
export const proRosterForm = [
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text'
  },
  {
    field: 'employeeName',
    title: '员工姓名',
    type: 'text'
  },
  {
    field: 'sex',
    title: '性别',
    type: 'radio',
    isHiden: true,
    optional: [
      {
        name: '男',
        value: '1'
      },
      {
        name: '女',
        value: '2'
      }
    ]
  },

  {
    field: 'idType',
    title: '证件类型',
    type: 'selected',
    isParams: true,
    paramsId: 'DOCUMENTTYPE'
  },
  {
    field: 'idNo',
    title: '证件号码',
    type: 'text'
  },
  {
    field: 'orgName',
    title: '部门名称',
    type: 'text',
    disableEdit: true,
    hideDetail: true
  },
  {
    field: 'orgId',
    title: '部门',
    isHiden: true,
    type: 'org'
  },
  {
    field: 'position',
    title: '岗位',
    type: 'selected',
    isParams: true,
    paramsId: 'POST'
  },
  {
    field: 'postLevel',
    title: '职级',
    type: 'selected',
    isParams: true,
    paramsId: 'RANK'

  },
  {
    field: 'employeeStatus',
    title: '员工状态',
    isHiden: true,
    type: 'radio',
    optional: [
      {
        name: '试用',
        value: '0'
      },
      {
        name: '在职',
        value: '9'
      }
    ]
  },
  {
    field: 'constractCompany',
    title: '合同公司',
    isHiden: true,
    type: 'contract-company'
  },
  {
    field: 'workNature',
    title: '工作性质',
    type: 'selected',
    isParams: true,
    paramsId: 'NATUREWORK'
  },
  {
    field: 'entryDate',
    title: '入职日期',
    isHiden: true,
    type: 'date'
  },
  {
    field: 'planCorrectionDate',
    title: '计划转正日期',
    type: 'date'
  },
  {
    field: 'mobile',
    title: '手机号码',
    type: 'number'
  },
  {
    field: 'companyEmail',
    title: '公司邮箱',
    type: 'email'
  },
  {
    field: 'workAddree',
    title: '工作地址',
    type: 'selected',
    isParams: true,
    paramsId: 'WORKPLACE'
  },

  {
    field: 'recruitmentChannel',
    title: '招聘渠道',
    type: 'selected',
    isHiden: true,
    isParams: true,
    paramsId: 'RECRUITMENTCHANNEL'
  },
  {
    field: 'refereeMan',
    isHiden: true,
    title: '推荐人',
    type: 'text'
  },
  {
    field: 'docList',
    title: '简历附件',
    type: 'file',
    busiKey: 'employeeNo',
    isHiden: true,
    disableEdit: true
  }
]

/**
 * 添加员工
 */
export const addRosterForm2 = [
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text'
  },
  {
    field: 'employeeName',
    title: '员工姓名',
    type: 'text'
  },
  {
    field: 'sex',
    title: '员工性别',
    type: 'radio',
    isHiden: true,
    optional: [
      {
        name: '男',
        value: '1'
      },
      {
        name: '女',
        value: '2'
      }
    ]
  },
  {
    field: 'idType',
    title: '证件类型',
    type: 'selected',
    isParams: true,
    paramsId: 'DOCUMENTTYPE'
  },
  {
    field: 'idNo',
    title: '证件号码',
    type: 'text'
  },
  {
    field: 'orgId',
    title: '所属部门',
    isHiden: true,
    type: 'org',
    itemChange: (form, b, c) => {
      form.position = ''
      const params = {
        orgId: form.orgId
      }
      const options = []
      getPositionApi(params).then(response => {
        if (response.success) {
          let data = []
          if (response.data) {
            data = response.data
          }
          data.forEach(v => {
            const a = {
              name: v.postName,
              value: v.postId
            }
            options.push(a)
          })
          addRosterForm2.forEach(v => {
            if (v.field === 'position') {
              v.options = []
              v.options = options
            }
            if (v.field === 'postLevel') {
              v.options = []
            }
          })
        }
      })
    }
  },
  {
    field: 'position',
    title: '所属岗位',
    info: '部门、岗位、职级为三级联动：部门 > 岗位 > 职级',
    type: 'selected',
    options: [
    ],
    itemChange: (form, item) => {
      form.postLevel = ''
      // console.log(form, item)
      if (form.orgId && form.position) {
        const params = {
          orgId: form.orgId,
          postId: form.position
        }
        const options = []
        getRankApi(params).then(response => {
          if (response.success) {
            if (response.data) {
              response.data.forEach(v => {
                const a = {
                  name: v.name,
                  value: v.id
                }
                options.push(a)
              })
              addRosterForm2.forEach(v => {
                if (v.field === 'postLevel') {
                  // v.options = []
                  // form.postLevel = undefined
                  v.options = options
                }
              })
            }
          }
        })
      }
    }
  },
  {
    field: 'postLevel',
    title: '所属职级',
    info: '部门、岗位、职级为三级联动：部门 > 岗位 > 职级',
    type: 'selected',
    options: []
  },
  {
    field: 'employeeStatus',
    title: '员工状态',
    isHiden: true,
    type: 'radio',
    optional: [
      {
        name: '试用',
        value: '0'
      },
      {
        name: '在职',
        value: '9'
      }
    ]
  },
  {
    field: 'constractCompany',
    title: '合同公司',
    isHiden: true,
    type: 'contract-company'
  },
  {
    field: 'workNature',
    title: '工作性质',
    type: 'selected',
    isParams: true,
    paramsId: 'NATUREWORK'
  },
  {
    field: 'entryDate',
    title: '入职日期',
    isHiden: true,
    type: 'date'
  },
  {
    field: 'conrrectionDate',
    title: '转正日期',
    type: 'date'
  },
  {
    field: 'workAddree',
    title: '工作地址',
    type: 'selected',
    isParams: true,
    paramsId: 'WORKPLACE'
  },
  {
    field: 'mobile',
    title: '手机号码',
    type: 'number'
  },
  {
    field: 'companyEmail',
    title: '公司邮箱',
    type: 'email'
  },


  {
    field: 'recruitmentChannel',
    title: '招聘渠道',
    type: 'selected',
    isHiden: true,
    isParams: true,
    paramsId: 'RECRUITMENTCHANNEL'
  },
  {
    field: 'refereeMan',
    isHiden: true,
    title: '推荐人',
    type: 'text'
  },
  {
    field: 'docList',
    title: '简历附件',
    type: 'file',
    busiKey: 'employeeNo'
  }
]

/**
 * 高级搜索
 */
export const searchRosterForm = [
  {
    field: 'employeeName',
    title: '员工姓名',
    type: 'text',
    searchable: true
  },
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text',
    info: '待入职员工没有员工号，无法使用员工号搜索待入职员工',
    searchable: true
  },
  {
    field: 'orgId',
    title: '机构',
    type: 'org',
    searchable: true
  }
]

/**
 * 办理转正
 */
export const convertFullRosterForm = [
  {
    field: 'employeeName',
    title: '员工姓名',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'sex',
    title: '员工性别',
    type: 'radio',
    disableEdit: true,
    optional: [
      {
        name: '男',
        value: '1'
      },
      {
        name: '女',
        value: '2'
      }
    ]
  },


  {
    field: 'orgId',
    title: '所属部门',
    isHiden: true,
    type: 'org',
    disableEdit: true
  },
  {
    field: 'position',
    title: '所属岗位',
    type: 'selected',
    isParams: true,
    paramsId: 'POST',
    disableEdit: true
  },
  {
    field: 'postLevel',
    title: '所属职级',
    type: 'selected',
    isHiden: true,
    isParams: true,
    paramsId: 'RANK',
    disableEdit: true
  },
  {
    field: 'entryDate',
    title: '入职日期',
    isHiden: true,
    type: 'date',
    disableEdit: true
  },
  {
    field: 'conrrectionDate',
    title: '转正日期',
    type: 'date'
  },
  {
    field: 'workNature',
    title: '工作性质',
    type: 'selected',
    isParams: true,
    paramsId: 'NATUREWORK'
  },
  {
    field: 'constractCompany',
    title: '合同公司',
    isHiden: true,
    type: 'contract-company'
  },
  {
    field: 'workAddree',
    title: '工作地址',
    type: 'selected',
    isParams: true,
    paramsId: 'WORKPLACE'
  },
  {
    field: 'mobile',
    title: '手机号码',
    type: 'number'
  },
  {
    field: 'companyEmail',
    title: '公司邮箱',
    type: 'email'
  }
]

/**
 * 人事异动
 */
export const changeRosterForm = [
  {
    field: 'employeeName',
    title: '员工姓名',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'workNature',
    title: '工作性质',
    type: 'selected',
    isParams: true,
    paramsId: 'NATUREWORK',
    disableEdit: true
  },
  {
    field: 'employeeStatus',
    title: '员工状态',
    type: 'selected',
    isParams: true,
    paramsId: 'EMPLOYEESTATUS',
    disableEdit: true
  },
  {
    field: 'turnoverType',
    title: '异动类型',
    type: 'radio',
    optional: [
      {
        name: '调岗',
        value: '5'
      },
      {
        name: '晋升',
        value: '3'
      },
      {
        name: '降级',
        value: '4'
      }
    ]
  },
  {
    field: 'turnoverCause',
    title: '异动原因',
    type: 'radio',
    optional: [
      {
        name: '工作安排',
        value: '1'
      },
      {
        name: '个人申请',
        value: '2'
      }
    ]
  },
  {
    field: 'originalOrgId',
    title: '原部门',
    type: 'org',
    disableEdit: true
  },
  {
    field: 'targetOrgId',
    title: '变更部门',
    type: 'org',
    itemChange: (form) => {
      form.targetPostLevel = ''
      form.targetPost = ''
      const params = {
        orgId: form.targetOrgId
      }
      const options = []
      getPositionApi(params).then(response => {
        if (response.success) {
          let data = []
          if (response.data) {
            data = response.data
          }
          data.forEach(v => {
            const a = {
              name: v.postName,
              value: v.postId
            }
            options.push(a)
          })
          changeRosterForm.forEach(v => {
            if (v.field === 'targetPost') {
              v.options = options
            }
            if (v.field === 'postLevel') {
              v.options = []
            }
          })
        }
      })
    }
  },
  {
    field: 'originalPost',
    title: '原岗位',
    type: 'selected',
    isParams: true,
    paramsId: 'POST',
    disableEdit: true
  },
  {
    field: 'targetPost',
    title: '变更岗位',
    info: '部门、岗位、职级为三级联动：部门 > 岗位 > 职级',
    type: 'selected',
    options: [],
    itemChange: (form, item) => {
      form.targetPostLevel = ''
      // console.log(form, item)
      if (form.orgId && form.position) {
        const params = {
          orgId: form.targetOrgId,
          postId: form.targetPost
        }
        const options = []
        getRankApi(params).then(response => {
          if (response.success) {
            if (response.data) {
              response.data.forEach(v => {
                const a = {
                  name: v.name,
                  value: v.id
                }
                options.push(a)
              })
              changeRosterForm.forEach(v => {
                if (v.field === 'targetPostLevel') {
                  v.options = options
                }
              })
            }
          }
        })
      }
    }
  },
  {
    field: 'originalPostLevel',
    title: '原职级',
    type: 'selected',
    isParams: true,
    paramsId: 'RANK',
    disableEdit: true
  },
  {
    field: 'targetPostLevel',
    title: '变更职级',
    info: '部门、岗位、职级为三级联动：部门 > 岗位 > 职级',
    type: 'selected',
    options: []
  },
  {
    field: 'originalWorkAddr',
    title: '原工作地址',
    type: 'selected',
    isParams: true,
    disableEdit: true,
    paramsId: 'WORKPLACE'
  },
  {
    field: 'targetWorkAddr',
    title: '变更工作地址',
    type: 'selected',
    isParams: true,
    paramsId: 'WORKPLACE'
  },
  {
    field: 'originalCompany',
    title: '原合同公司',
    type: 'contract-company',
    disableEdit: true
  },
  {
    field: 'targetCompany',
    title: '变更合同公司',
    type: 'contract-company',
  },
  {
    field: 'effectDate',
    title: '生效日期',
    type: 'date'
  },

  {
    field: 'remarks',
    title: '备注',
    type: 'text',
    isHiden: true
  }
]

/**
 * 办理离职
 */
export const dealQuitForm = [
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'leaveApplyDate',
    title: '离职申请日期',
    type: 'date'
  },
  {
    field: 'lastWorkDate',
    title: '最后工作日期',
    type: 'date'
  },
  {
    field: 'isSalarySettled',
    title: '工资是否结算',
    type: 'radio',
    optional: [
      {
        name: '是',
        value: '1'
      },
      {
        name: '否',
        value: '0'
      }
    ]
  },
  {
    field: 'salarySettledDate',
    title: '薪资结算日期',
    type: 'date'
  },
  {
    field: 'leaveReason',
    title: '离职原因',
    type: 'text'
  },
  {
    field: 'remarks',
    title: '备注',
    type: 'text',
    isHiden: true
  }
]

/**
 * 办理入职
 */
export const dealOnJobForm = [
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text'
  },
  {
    field: 'employeeName',
    title: '员工姓名',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'sex',
    title: '员工性别',
    type: 'radio',
    isHiden: true,
    disableEdit: true,
    optional: [
      {
        name: '男',
        value: '1'
      },
      {
        name: '女',
        value: '2'
      }
    ]
  },
  {
    field: 'orgId',
    title: '所属部门',
    type: 'org',
    disableEdit: true
  },
  {
    field: 'position',
    title: '所属岗位',
    isParams: true,
    paramsId: 'POST',
    disableEdit: true
  },
  {
    field: 'postLevel',
    title: '所属职级',
    type: 'selected',
    isParams: true,
    paramsId: 'RANK',
    disableEdit: true
  },
  {
    field: 'employeeStatus',
    title: '员工状态',
    type: 'radio',
    optional: [
      {
        name: '试用',
        value: '0'
      },
      {
        name: '在职',
        value: '9'
      }
    ]
  },
  {
    field: 'idType',
    title: '证件类型',
    type: 'selected',
    isParams: true,
    paramsId: 'DOCUMENTTYPE'
  },
  {
    field: 'idNo',
    title: '证件号码',
    type: 'text'
  },
  {
    field: 'entryDate',
    title: '入职日期',
    type: 'date'
  },
  {
    field: 'conrrectionDate',
    title: '转正日期',
    type: 'date'
  },
  {
    field: 'constractCompany',
    title: '合同公司',
    type: 'contract-company'
  },
  {
    field: 'workNature',
    title: '工作性质',
    type: 'selected',
    isParams: true,
    paramsId: 'NATUREWORK'
  },
  {
    field: 'workAddree',
    title: '工作地址',
    type: 'selected',
    isParams: true,
    paramsId: 'WORKPLACE'
  },
  {
    field: 'mobile',
    title: '手机号码',
    type: 'number'
  },
  {
    field: 'companyEmail',
    title: '公司邮箱',
    type: 'email'
  },
  {
    field: 'recruitmentChannel',
    title: '招聘渠道',
    type: 'selected',
    isParams: true,
    paramsId: 'RECRUITMENTCHANNEL'
  },
  {
    field: 'refereeMan',
    title: '推荐人',
    type: 'text'
  },
  {
    field: 'intvId',
    title: '面试人ID',
    type: 'text'
  },
  {
    field: 'docList',
    title: '入职简历',
    type: 'file',
    busiKey: 'intvId',
    busiFunc: 'hr_interviewer',
    disableEdit: true
  }

]

/**
 * 放弃入职
 */
export const abandonJobForm = [
  {
    field: 'remarks',
    title: '放弃入职原因',
    type: 'text'
  }
]

/**
 * 延长试用期
 * employeeNo 员工号
 * planCorrectionDate 计划转正日期
 * delayCorrectionDate 延期转正日期
 * delayApplyDate 延期申请日期
 * delayReason 延期原因
 * insertUser 新增操作员
 */
export const extendProbationForm = [
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'delayApplyDate',
    title: '延期申请日期',
    type: 'date'
  },
  {
    field: 'planCorrectionDate',
    title: '计划转正日期',
    type: 'date',
    disableEdit: true
  },
  {
    field: 'delayCorrectionDate',
    title: '延期转正日期',
    type: 'date'
  },
  {
    field: 'delayReason',
    title: '延期原因',
    type: 'text'
  }
]

/**
 * 确认离职
 * leaveApplyDate 离职申请日期
 * lastWorkDate 最后工作日期
 * isSalarySettled 工资是否结算
 * salarySettledDate 薪资结算日期
 * leaveReason 离职原因
 * remarks 备注
 */
export const confirmQuitForm = [
  {
    field: 'leaveApplyDate',
    title: '离职申请日期',
    type: 'date'
  },
  {
    field: 'lastWorkDate',
    title: '最后工作日期',
    type: 'date'
  },
  {
    field: 'isSalarySettled',
    title: '工资结算',
    type: 'radio',
    optional: [
      {
        name: '是',
        value: '1'
      },
      {
        name: '否',
        value: '0'
      }
    ]
  },
  {
    field: 'salarySettledDate',
    title: '薪资结算日期',
    type: 'date'
  },
  {
    field: 'leaveReason',
    title: '离职原因',
    type: 'text'
  },
  {
    field: 'remarks',
    title: '备注',
    type: 'text',
    isHiden: true
  }
]

/**
 * 调整离职信息
 */
export const adjustQuitForm = [
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'leaveApplyDate',
    title: '申请离职日期',
    type: 'date'
  },
  {
    field: 'lastWorkDate',
    title: '最后工作日期',
    type: 'date'
  },
  {
    field: 'isSalarySettled',
    title: '工资是否结算',
    type: 'radio',
    optional: [
      {
        name: '是',
        value: '1'
      },
      {
        name: '否',
        value: '0'
      }
    ]
  },
  {
    field: 'salarySettledDate',
    title: '薪资结算日期',
    type: 'date'
  },
  {
    field: 'leaveReason',
    title: '离职原因',
    type: 'text'
  },
  {
    field: 'remarks',
    title: '备注',
    type: 'text',
    isHiden: true
  }
]

/**
 * 撤销离职
 *
 */
export const revokeQuitForm = [
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text'
  },
  {
    field: 'employeeStatus',
    title: '员工状态',
    isHiden: true,
    type: 'radio',
    optional: [
      {
        name: '试用',
        value: '0'
      },
      {
        name: '在职',
        value: '9'
      }
    ]
  }
]

/**
 * 调整入职信息
 */
export const adjustOnJobForm = [
  {
    field: 'intvId',
    title: '面试ID',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'orgId',
    title: '原机构',
    type: 'org',
    disableEdit: true
  },
  {
    field: 'targetOrgId',
    title: '变更机构',
    type: 'org',
    itemChange: (form) => {
      form.targetPostLevel = ''
      form.targetPost = ''
      const params = {
        orgId: form.targetOrgId
      }
      const options = []
      getPositionApi(params).then(response => {
        if (response.success) {
          let data = []
          if (response.data) {
            data = response.data
          }
          data.forEach(v => {
            const a = {
              name: v.postName,
              value: v.postId
            }
            options.push(a)
          })
          adjustOnJobForm.forEach(v => {
            if (v.field === 'targetPost') {
              v.options = []
              v.options = options
            }
            if (v.field === 'targetPostLevel') {
              v.options = []
            }
          })
        }
      })
    }
  },
  {
    field: 'position',
    title: '原岗位',
    type: 'selected',
    isParams: true,
    paramsId: 'POST',
    disableEdit: true
  },
  {
    field: 'targetPost',
    title: '变更岗位',
    type: 'selected',
    info: '部门、岗位、职级为三级联动：部门 > 岗位 > 职级',
    options: [],
    itemChange: (form, item) => {
      form.targetPostLevel = ''
      if (form.orgId && form.position) {
        const params = {
          orgId: form.targetOrgId,
          postId: form.targetPost
        }
        const options = []
        getRankApi(params).then(response => {
          if (response.success) {
            if (response.data) {
              response.data.forEach(v => {
                const a = {
                  name: v.name,
                  value: v.id
                }
                options.push(a)
              })
              adjustOnJobForm.forEach(v => {
                if (v.field === 'targetPostLevel') {
                  v.options = []
                  v.options = options
                }
              })
            }
          }
        })
      }
    }
  },
  {
    field: 'postLevel',
    title: '原职级',
    type: 'selected',
    isParams: true,
    paramsId: 'RANK',
    disableEdit: true
  },
  {
    field: 'targetPostLevel',
    title: '变更职级',
    info: '部门、岗位、职级为三级联动：部门 > 岗位 > 职级',
    type: 'selected',
    options: []
  },
  {
    field: 'entryDate',
    title: '入职日期',
    type: 'date'
  },
  {
    field: 'workNature',
    title: '工作性质',
    type: 'selected',
    isParams: true,
    paramsId: 'NATUREWORK'
  },
  {
    field: 'education',
    title: '最高学历',
    type: 'selected',
    isParams: true,
    paramsId: 'EDUCATION'
  },
  {
    field: 'graduationSchool',
    title: '毕业学校',
    type: 'text'
  },

  {
    field: 'workLife',
    title: '工作年限',
    type: 'text'
  },
  {
    field: 'email',
    title: '常用邮箱',
    type: 'email'
  },
  {
    field: 'mobile',
    title: '手机号',
    type: 'text'
  },


  {
    field: 'remarks',
    title: '备注',
    type: 'text',
    isHiden: true
  },
  {
    field: 'docList',
    title: '入职简历',
    type: 'file',
    busiKey: 'intvId',
    busiFunc: 'hr_interviewer',
    disableEdit: true
  }
]

/**
 * 重新入职
 */
export const reOnJobForm = [
  {
    field: 'employeeName',
    title: '员工姓名',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text',
    disableEdit: true
  },
  {
    field: 'sex',
    title: '性别',
    type: 'radio',
    isHiden: true,
    disableEdit: true,
    optional: [
      {
        name: '男',
        value: '1'
      },
      {
        name: '女',
        value: '2'
      }
    ]
  },
  {
    field: 'employeeStatus',
    title: '员工状态',
    isHiden: true,
    type: 'radio',
    optional: [
      {
        name: '试用',
        value: '0'
      },
      {
        name: '在职',
        value: '9'
      }
    ]
  },
  {
    field: 'idType',
    title: '证件类型',
    type: 'selected',
    isParams: true,
    paramsId: 'DOCUMENTTYPE'
  },
  {
    field: 'idNo',
    title: '证件号码',
    type: 'text'
  },

  {
    field: 'orgId',
    title: '部门',
    isHiden: true,
    type: 'org',
    info: '部门、岗位、职级为三级联动：部门 > 岗位 > 职级',
    init: (form, item) => {
      const params = {
        orgId: form.orgId
      }
      const options = []
      getPositionApi(params).then(response => {
        if (response.success) {
          let data = []
          if (response.data) {
            data = response.data
          }
          data.forEach(v => {
            const a = {
              name: v.postName,
              value: v.postId
            }
            options.push(a)
          })
          reOnJobForm.forEach(v => {
            if (v.field === 'position') {
              v.options = options
            }
          })
        }
      })
    },
    itemChange: (form, b, c) => {
      const params = {
        orgId: form.orgId
      }
      const options = []
      getPositionApi(params).then(response => {
        if (response.success) {
          let data = []
          if (response.data) {
            data = response.data
          }
          data.forEach(v => {
            const a = {
              name: v.postName,
              value: v.postId
            }
            options.push(a)
          })
          reOnJobForm.forEach(v => {
            if (v.field === 'position') {
              v.options = []
              form.position = ''
              v.options = options
            }
            if (v.field === 'postLevel') {
              v.options = []
              form.postLevel = ''
            }
          })
        }
      })
    }
  },
  {
    field: 'position',
    title: '岗位',
    type: 'selected',
    info: '部门、岗位、职级为三级联动：部门 > 岗位 > 职级',
    options: [],
    init: (form, item) => {
      if (form.orgId && form.position) {
        const params = {
          orgId: form.orgId,
          postId: form.position
        }
        const options = []
        getRankApi(params).then(response => {
          if (response.success) {
            if (response.data) {
              response.data.forEach(v => {
                const a = {
                  name: v.name,
                  value: v.id
                }
                options.push(a)
              })
              reOnJobForm.forEach(v => {
                if (v.field === 'postLevel') {
                  v.options = options
                }
              })
            }
          }
        })
      }
    },
    itemChange: (form, item) => {
      if (form.orgId && form.position) {
        const params = {
          orgId: form.orgId,
          postId: form.position
        }
        const options = []
        getRankApi(params).then(response => {
          if (response.success) {
            if (response.data) {
              response.data.forEach(v => {
                const a = {
                  name: v.name,
                  value: v.id
                }
                options.push(a)
              })
              reOnJobForm.forEach(v => {
                if (v.field === 'postLevel') {
                  form.postLevel = ''
                  v.options = options
                }
              })
            }
          }
        })
      }
    }
  },
  {
    field: 'postLevel',
    title: '职级',
    type: 'selected',
    isHiden: true,
    options: []
  },
  {
    field: 'entryDate',
    title: '入职日期',
    isHiden: true,
    type: 'date'
  },
  {
    field: 'conrrectionDate',
    title: '转正日期',
    type: 'date'
  },

  {
    field: 'constractCompany',
    title: '合同公司',
    isHiden: true,
    type: 'contract-company'
  },
  {
    field: 'workAddree',
    title: '工作地址',
    type: 'selected',
    isParams: true,
    paramsId: 'WORKPLACE'
  },
  {
    field: 'workNature',
    title: '工作性质',
    type: 'selected',
    isParams: true,
    paramsId: 'NATUREWORK'
  },
  {
    field: 'mobile',
    title: '手机号码',
    type: 'number'
  },
  {
    field: 'companyEmail',
    title: '公司邮箱',
    type: 'email'
  },
  {
    field: 'recruitmentChannel',
    title: '招聘渠道',
    type: 'selected',
    isHiden: true,
    isParams: true,
    paramsId: 'RECRUITMENTCHANNEL'
  },
  {
    field: 'refereeMan',
    isHiden: true,
    title: '推荐人',
    type: 'text'
  }
]


/**
 * 试用期
 */
export const shiYonForm = [

  {
    field: 'employeeNo',
    title: '员工号',
    type: 'text'
  },
  {
    field: 'employeeName',
    title: '员工姓名',
    type: 'text'
  },
  {
    field: 'sex',
    title: '性别',
    type: 'radio',
    isHiden: true,
    optional: [
      {
        name: '男',
        value: '1'
      },
      {
        name: '女',
        value: '2'
      }
    ]
  },

  {
    field: 'idType',
    title: '证件类型',
    type: 'selected',
    isParams: true,
    isHiden: true,
    paramsId: 'DOCUMENTTYPE'
  },
  {
    field: 'idNo',
    title: '证件号码',
    isHiden: true,
    type: 'text'
  },
  {
    field: 'orgName',
    title: '部门名称',
    type: 'text',
    disableEdit: true,
    hideDetail: true
  },
  {
    field: 'orgId',
    title: '部门',
    isHiden: true,
    type: 'org'
  },
  {
    field: 'position',
    title: '岗位',
    type: 'selected',
    isParams: true,
    paramsId: 'POST'
  },
  {
    field: 'postLevel',
    title: '职级',
    type: 'selected',
    isHiden: true,
    isParams: true,
    paramsId: 'RANK'
  },
  {
    field: 'employeeStatus',
    title: '员工状态',
    isHiden: true,
    type: 'radio',
    optional: [
      {
        name: '试用',
        value: '0'
      },
      {
        name: '在职',
        value: '9'
      }
    ]
  },
  {
    field: 'constractCompany',
    title: '合同公司',
    isHiden: true,
    type: 'contract-company'
  },
  {
    field: 'workNature',
    title: '工作性质',
    type: 'selected',
    isParams: true,
    isHiden: true,
    paramsId: 'NATUREWORK'
  },
  {
    field: 'entryDate',
    title: '入职日期',
    type: 'date'
  },
  {
    field: 'planCorrectionDate',
    title: '计划转正日期',
    type: 'date'
  },
  {
    field: 'mobile',
    title: '手机号码',
    type: 'number'
  },
  {
    field: 'companyEmail',
    title: '公司邮箱',
    type: 'email'
  },
  {
    field: 'workAddree',
    title: '工作地址',
    type: 'selected',
    isParams: true,
    paramsId: 'WORKPLACE'
  },
  {
    field: 'statusName',
    title: '状态',
    type: 'text'
  },
  {
    field: 'recruitmentChannel',
    title: '招聘渠道',
    type: 'selected',
    isHiden: true,
    isParams: true,
    paramsId: 'RECRUITMENTCHANNEL'
  },
  {
    field: 'refereeMan',
    isHiden: true,
    title: '推荐人',
    type: 'text'
  }
]


